package com.cygnus.controller;

import com.cygnus.model.Department;
import com.cygnus.model.Msg;
import com.cygnus.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/*
处理和部门有关的请求
 */
@Controller
public class DepartmentController {
    @Autowired
    DepartmentService departmentService;
    @ResponseBody
    @RequestMapping("/depts")
    public Msg getDepts(){
        List<Department> list;
        List<Department> departments = departmentService.getDepts();
        return Msg.success().add("departments",departments);
    }
}
